unsigned int mmu_update_queue_idx = 0;
#define idx mmu_update_queue_idx
-#if MMU_UPDATE_DEBUG > 0
-page_update_debug_t update_debug_queue[QUEUE_SIZE] = {{0}};
-#undef queue_l1_entry_update
-#undef queue_l2_entry_update
-#endif
-#if MMU_UPDATE_DEBUG > 3
-static void DEBUG_allow_pt_reads(void)
-{
- pte_t *pte;
- mmu_update_t update;
- int i;
- for ( i = idx-1; i >= 0; i-- )
- {
- pte = update_debug_queue[i].ptep;
- if ( pte == NULL ) continue;
- update_debug_queue[i].ptep = NULL;
- update.ptr = virt_to_machine(pte);
- update.val = update_debug_queue[i].pteval;
- HYPERVISOR_mmu_update(&update, 1, NULL);
- }
-}
-static void DEBUG_disallow_pt_read(unsigned long va)
-{
- pte_t *pte;
- pmd_t *pmd;
- pgd_t *pgd;
- unsigned long pteval;
- /*
- * We may fault because of an already outstanding update.
- * That's okay -- it'll get fixed up in the fault handler.
- */
- mmu_update_t update;
- pgd = pgd_offset_k(va);
- pmd = pmd_offset(pgd, va);
- pte = pte_offset_kernel(pmd, va); /* XXXcl */
- update.ptr = virt_to_machine(pte);
- pteval = *(unsigned long *)pte;
- update.val = pteval & ~_PAGE_PRESENT;
- HYPERVISOR_mmu_update(&update, 1, NULL);
- update_debug_queue[idx].ptep = pte;
- update_debug_queue[idx].pteval = pteval;
-}
-#endif
-
-#if MMU_UPDATE_DEBUG > 1
-#undef queue_pt_switch
-#undef queue_tlb_flush
-#undef queue_invlpg
-#undef queue_pgd_pin
-#undef queue_pgd_unpin
-#undef queue_pte_pin
-#undef queue_pte_unpin
-#undef queue_set_ldt
-#endif
-
-
/*
* MULTICALL_flush_page_update_queue:
* This is a version of the flush which queues as part of a multicall.
spin_lock_irqsave(&update_lock, flags);
if ( (_idx = idx) != 0 )
{
-#if MMU_UPDATE_DEBUG > 1
- if (idx > 1)
- printk("Flushing %d entries from pt update queue\n", idx);
-#endif
-#if MMU_UPDATE_DEBUG > 3
- DEBUG_allow_pt_reads();
-#endif
idx = 0;
wmb(); /* Make sure index is cleared first to avoid double updates. */
queue_multicall3(__HYPERVISOR_mmu_update,
static inline void __flush_page_update_queue(void)
{
unsigned int _idx = idx;
-#if MMU_UPDATE_DEBUG > 1
- if (idx > 1)
- printk("Flushing %d entries from pt update queue\n", idx);
-#endif
-#if MMU_UPDATE_DEBUG > 3
- DEBUG_allow_pt_reads();
-#endif
idx = 0;
wmb(); /* Make sure index is cleared first to avoid double updates. */
if ( unlikely(HYPERVISOR_mmu_update(update_queue, _idx, NULL) < 0) )
{
unsigned long flags;
spin_lock_irqsave(&update_lock, flags);
-#if MMU_UPDATE_DEBUG > 3
- DEBUG_disallow_pt_read((unsigned long)ptr);
-#endif
update_queue[idx].ptr = virt_to_machine(ptr);
update_queue[idx].val = val;
increment_index();
{
unsigned long flags;
spin_lock_irqsave(&update_lock, flags);
-#if MMU_UPDATE_DEBUG > 3
- DEBUG_disallow_pt_read((unsigned long)ptr);
-#endif
update_queue[idx].ptr = virt_to_machine(ptr);
update_queue[idx].val = val;
increment_index_and_flush();
void xen_pte_unpin(unsigned long ptr);
void xen_set_ldt(unsigned long ptr, unsigned long bytes);
void xen_machphys_update(unsigned long mfn, unsigned long pfn);
-#define MMU_UPDATE_DEBUG 0
-
-#if MMU_UPDATE_DEBUG > 0
-typedef struct {
- void *ptr;
- unsigned long val, pteval;
- void *ptep;
- int line; char *file;
-} page_update_debug_t;
-extern page_update_debug_t update_debug_queue[];
-#define queue_l1_entry_update(_p,_v) ({ \
- update_debug_queue[mmu_update_queue_idx].ptr = (_p); \
- update_debug_queue[mmu_update_queue_idx].val = (_v); \
- update_debug_queue[mmu_update_queue_idx].line = __LINE__; \
- update_debug_queue[mmu_update_queue_idx].file = __FILE__; \
- queue_l1_entry_update((_p),(_v)); \
-})
-#define queue_l2_entry_update(_p,_v) ({ \
- update_debug_queue[mmu_update_queue_idx].ptr = (_p); \
- update_debug_queue[mmu_update_queue_idx].val = (_v); \
- update_debug_queue[mmu_update_queue_idx].line = __LINE__; \
- update_debug_queue[mmu_update_queue_idx].file = __FILE__; \
- queue_l2_entry_update((_p),(_v)); \
-})
-#endif
-
-#if MMU_UPDATE_DEBUG > 1
-#if MMU_UPDATE_DEBUG > 2
-#undef queue_l1_entry_update
-#define queue_l1_entry_update(_p,_v) ({ \
- update_debug_queue[mmu_update_queue_idx].ptr = (_p); \
- update_debug_queue[mmu_update_queue_idx].val = (_v); \
- update_debug_queue[mmu_update_queue_idx].line = __LINE__; \
- update_debug_queue[mmu_update_queue_idx].file = __FILE__; \
- printk("L1 %s %d: %p/%08lx (%08lx -> %08lx)\n", __FILE__, __LINE__, \
- (_p), virt_to_machine(_p), pte_val(*(_p)), \
- (unsigned long)(_v)); \
- queue_l1_entry_update((_p),(_v)); \
-})
-#endif
-#undef queue_l2_entry_update
-#define queue_l2_entry_update(_p,_v) ({ \
- update_debug_queue[mmu_update_queue_idx].ptr = (_p); \
- update_debug_queue[mmu_update_queue_idx].val = (_v); \
- update_debug_queue[mmu_update_queue_idx].line = __LINE__; \
- update_debug_queue[mmu_update_queue_idx].file = __FILE__; \
- printk("L2 %s %d: %p/%08lx (%08lx -> %08lx)\n", __FILE__, __LINE__, \
- (_p), virt_to_machine(_p), pmd_val(*_p), \
- (unsigned long)(_v)); \
- queue_l2_entry_update((_p),(_v)); \
-})
-#define queue_pt_switch(_p) ({ \
- printk("PTSWITCH %s %d: %08lx\n", __FILE__, __LINE__, (_p)); \
- queue_pt_switch(_p); \
-})
-#define queue_tlb_flush() ({ \
- printk("TLB FLUSH %s %d\n", __FILE__, __LINE__); \
- queue_tlb_flush(); \
-})
-#define queue_invlpg(_p) ({ \
- printk("INVLPG %s %d: %08lx\n", __FILE__, __LINE__, (_p)); \
- queue_invlpg(_p); \
-})
-#define queue_pgd_pin(_p) ({ \
- printk("PGD PIN %s %d: %08lx/%08lx\n", __FILE__, __LINE__, (_p), \
- phys_to_machine(_p)); \
- queue_pgd_pin(_p); \
-})
-#define queue_pgd_unpin(_p) ({ \
- printk("PGD UNPIN %s %d: %08lx\n", __FILE__, __LINE__, (_p)); \
- queue_pgd_unpin(_p); \
-})
-#define queue_pte_pin(_p) ({ \
- printk("PTE PIN %s %d: %08lx\n", __FILE__, __LINE__, (_p)); \
- queue_pte_pin(_p); \
-})
-#define queue_pte_unpin(_p) ({ \
- printk("PTE UNPIN %s %d: %08lx\n", __FILE__, __LINE__, (_p)); \
- queue_pte_unpin(_p); \
-})
-#define queue_set_ldt(_p,_l) ({ \
- printk("SETL LDT %s %d: %08lx %d\n", __FILE__, __LINE__, (_p), (_l)); \
- queue_set_ldt((_p), (_l)); \
-})
-#endif
void _flush_page_update_queue(void);
static inline int flush_page_update_queue(void)